﻿using QQZiFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static TestProject1.PermissionSlutionDBData;

namespace TestProject1
{
    [DBTable(TableName = "amis_sln_definition")]
    public class PermissionSlutionDBData : PermissionSlutionData
    {


        /// <summary>
        /// 主键
        /// </summary>
        /// <value></value>
        [DBField(Usage = DBFieldUsage.PrimaryKey, Identity = true)]
        public int Id { get; set; }

        /// <summary>
        /// 方案的key
        /// </summary>
        /// <value></value>
        public string SLN { get; set; }

        /// <summary>
        /// 主OEM名
        /// </summary>
        /// <value></value>
        public string OEM { get; set; }

        public PermissionSlutionDBData()
        {

        }

        string queryBuilderString, whereObjectString;
        [DBField(FieldName = "Builder")]
        public string QueryBuilderString
        {
            get
            {
                return queryBuilderString;
            }
            set
            {
                queryBuilderString = value;
                base.Builder = Newtonsoft.Json.JsonConvert.DeserializeObject<QueryBuilder>(value);
            }
        }
        [DBField(FieldName = "WhereObject")]
        public string WhereObjectString
        {
            get
            {
                return whereObjectString;
            }
            set
            {
                whereObjectString = value;
                base.WhereObject = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(value);
            }
        }
        public override QueryBuilder Builder
        {
            get { return base.Builder; }
            set
            {
                base.Builder = value;
                if (value == null) queryBuilderString = null;
                else queryBuilderString = Newtonsoft.Json.JsonConvert.SerializeObject(value);
            }
        }


        public override Dictionary<string, string> WhereObject
        {
            get { return base.WhereObject; }
            set
            {
                base.WhereObject = value;
                if (value == null) whereObjectString = null;
                else whereObjectString = Newtonsoft.Json.JsonConvert.SerializeObject(value);
            }
        }

        /// <summary>
        /// 软删除  0删除，1正常
        /// </summary>

        [DBField(Usage = DBFieldUsage.MarkDelete, MarkDeleteValue = new int[] { 1, 0 })]
        public int? Status { get; set; }

    }
}